<template>
  <div class="menu-content-tabs">
    <div class="tab"
         v-for="(tab, index) in tabs"
         :key="index"
         :class="activeIndex === index && 'tab-active'"
         @click="checkTab(tab, index)">
      {{ tab.name }}
    </div>
  </div>
</template>

<script>
export default {
  name: 'MenuContentTabs',
  props: {
    tabs: Array,
		defaltActive:0
  },
  data() {
    return {
      activeIndex: 0
    }
  },
	created() {
		this.activeIndex = this.defaltActive || 0
	},
  methods: {
    checkTab(tab, index) {
      this.activeIndex = index
      this.$emit('switch-tab', tab)
    }
  }
}
</script>

<style lang="scss" scoped>
@import "~@/assets/style/common.scss";

.menu-content-tabs {
  height: 50px;
  display: flex;
  align-items: center;
  color: #666;
  font-size: 15px;
  border-bottom: 1px solid #eee;

  .tab {
    padding: 15px;
    margin-right: 15px;
    border-bottom: solid 3px rgba(255, 255, 255, 0);
    cursor: pointer;
  }

  .tab-active {
    color: $theme-color-1;
    border-bottom: solid 3px $theme-color-1;
    box-sizing: border-box;
  }
}
</style>
